# frozen_string_literal: true

FactoryBot.define do
  factory :rule_version do
    rule
    type { RuleEntity::GeneralRule::Condition::Any }
    status { RuleEntity::Status::CREATED }
    stage { RuleEntity::Stage::DRAFT }
    policy { RuleEntity::Policy::FIRST }
    version { 0 }

    # type
    trait :general_rule_dsl do
      type { RuleEntity::GeneralRule::DSL }
    end
    trait :general_rule_condition_any do
      type { RuleEntity::GeneralRule::Condition::Any }
    end
    trait :general_rule_condition_all do
      type { RuleEntity::GeneralRule::Condition::All }
    end
    trait :general_rule_condition_dsl do
      type { RuleEntity::GeneralRule::Condition::Dsl }
    end
    trait :decision_table do
      type { RuleEntity::DecisionTable }
    end
    trait :rule_set do
      type { RuleEntity::RuleSet }
    end

    # status
    trait :created do
      status { RuleEntity::Status::CREATED }
    end
    trait :validated do
      status { RuleEntity::Status::VALIDATED }
    end
    trait :deployed do
      status { RuleEntity::Status::DEPLOYED }
    end

    # stage
    trait :draft do
      stage { RuleEntity::Stage::DRAFT }
    end
    trait :draft do
      stage { RuleEntity::Stage::PRODUCT }
    end

    # policy
    trait :first do
      policy { RuleEntity::Policy::FIRST }
    end
    trait :draft do
      policy { RuleEntity::Policy::ALL }
    end
  end
end
